/**
 * 公用的store存储文件
 */
const state = {
  paramsStack: [] // 参数栈
}
const getters = {
  paramsStack (state) {
    return state.paramsStack ? state.paramsStack : JSON.parse(sessionStorage.getItem('_PARAMS_STACK_'))
  }
}
const actions = {
  // 设置参数入栈，栈中始终保持三个参数
  pushParams (state, params) {
    state.paramsStack.puhs(params)
    state.paramsStack.length > 3 && state.paramsStack.shift()
    sessionStorage.setItem('_PARAMS_STACK_', JSON.stringify(state.paramsStack))
  },
  // 清空参数栈
  clearParamsStack (state) {
    state.paramsStack = []
    sessionStorage.setItem('_PARAMS_STACK_', JSON.stringify(state.paramsStack))
  }
}
const mutations = {}
export default {
  state,
  getters,
  actions,
  mutations
}
